<template>
    <header class="header">
      <div class="header-container">
        <h1 class="logo">{{ siteTitle }}</h1>
        <nav class="nav" :class="{ 'nav-active': isMenuOpen }">
          <ul class="nav-list">
            <li v-for="item in navItems" :key="item.id">
              <a :href="item.link">{{ item.text }}</a>
            </li>
          </ul>
          <el-input style="width: 240px" placeholder="Please input" />
        </nav>
        <button class="menu-toggle" @click="toggleMenu">
          <span class="bar"></span>
          <span class="bar"></span>
          <span class="bar"></span>
        </button>
      </div>
    </header>
  </template>
  
  <script setup>
  import { ref } from 'vue'
  
  const siteTitle = 'BLOG'
  const isMenuOpen = ref(false)
  
  const navItems = [
    { id: 1, text: '首页', link: '/' },
    { id: 2, text: '关于', link: '#' },
  ]
  
  const toggleMenu = () => {
    isMenuOpen.value = !isMenuOpen.value
  }
  </script>
  
  <style scoped>
  .header {
    background-color: #4166d5;
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
  }
  
  .logo {
    font-size: 1.5rem;
  }
  .nav{
    display: flex;
    line-height: 35px;
  }

  .nav-list {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin-right: 20px;
  }
  
  .nav-list a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
  }
  
  .nav-list a:hover {
    color: #3498db;
  }
  
  .menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
  }
  
  .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: white;
    transition: all 0.3s ease;
  }
  
  @media (max-width: 768px) {
    .menu-toggle {
      display: block;
    }
    
    .nav {
      position: absolute;
      top: 100%;
      left: 0;
      width: 100%;
      background-color: #2c3e50;
      clip-path: circle(0px at 90% -10%);
      transition: all 0.5s ease-out;
      pointer-events: none;
    }
    
    .nav-active {
      clip-path: circle(1000px at 90% -10%);
      pointer-events: all;
    }
    
    .nav-list {
      flex-direction: column;
      align-items: center;
      padding: 1rem 0;
      gap: 0;
    }
    
    .nav-list li {
      width: 100%;
      text-align: center;
      padding: 0.5rem 0;
    }
  }
  </style>